package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.RentalDeviceCategoriesMapper;
import com.hello.system.domain.RentalDeviceCategories;
import com.hello.system.service.IRentalDeviceCategoriesService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 设备分类Service业务层处理
 * 
 * @author hello
 * @date 2025-07-20
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class RentalDeviceCategoriesServiceImpl extends ServiceImpl<RentalDeviceCategoriesMapper, RentalDeviceCategories> implements IRentalDeviceCategoriesService 
{
    private final RentalDeviceCategoriesMapper rentalDeviceCategoriesMapper;

    /**
     * 查询设备分类
     * 
     * @param categoryId 设备分类主键
     * @return 设备分类
     */
    @Override
    public RentalDeviceCategories selectRentalDeviceCategoriesByCategoryId(Long categoryId)
    {
        return rentalDeviceCategoriesMapper.selectRentalDeviceCategoriesByCategoryId(categoryId);
    }

    /**
     * 查询设备分类列表
     * 
     * @param rentalDeviceCategories 设备分类
     * @return 设备分类
     */
    @Override
    public List<RentalDeviceCategories> selectRentalDeviceCategoriesList(RentalDeviceCategories rentalDeviceCategories)
    {
        return rentalDeviceCategoriesMapper.selectRentalDeviceCategoriesList(rentalDeviceCategories);
    }

    /**
     * 新增设备分类
     * 
     * @param rentalDeviceCategories 设备分类
     * @return 结果
     */
    @Override
    public int insertRentalDeviceCategories(RentalDeviceCategories rentalDeviceCategories)
    {
        rentalDeviceCategories.setCreateTime(DateUtils.getNowDate());
        return rentalDeviceCategoriesMapper.insertRentalDeviceCategories(rentalDeviceCategories);
    }

    /**
     * 修改设备分类
     * 
     * @param rentalDeviceCategories 设备分类
     * @return 结果
     */
    @Override
    public int updateRentalDeviceCategories(RentalDeviceCategories rentalDeviceCategories)
    {
        rentalDeviceCategories.setUpdateTime(DateUtils.getNowDate());
        return rentalDeviceCategoriesMapper.updateRentalDeviceCategories(rentalDeviceCategories);
    }


    /**
     * 批量删除设备分类
     * 
     * @param categoryIds 需要删除的设备分类主键
     * @return 结果
     */
    @Override
    public int deleteRentalDeviceCategoriesByCategoryIds(Long[] categoryIds)
    {
        return rentalDeviceCategoriesMapper.deleteRentalDeviceCategoriesByCategoryIds(categoryIds);
    }

    /**
     * 删除设备分类信息
     * 
     * @param categoryId 设备分类主键
     * @return 结果
     */
    @Override
    public int deleteRentalDeviceCategoriesByCategoryId(Long categoryId)
    {
        return rentalDeviceCategoriesMapper.deleteRentalDeviceCategoriesByCategoryId(categoryId);
    }
}
